import { protectedRequest } from './index';
const request = protectedRequest();

/**
 * 获取clients列表
 */
const clientListReq = () => request({
  method: 'get',
  url: `/client/list`,
});


/**
 * 获取client信息
 * @param {number} id
 */
const clientCheckReq = (id) => request({
  method: 'get',
  url: `/client/check/${id}`,
});

/**
 * 添加客户
 * @param {object} client 
 */
const clientAppendReq = (client) => request({
  method: 'post',
  url: `/client/append`,
  data: client
});

/**
 * 更新客户信息
 * @param {number} id
 * @param {object} client 
 */
const clientUpdateReq = (id, client) => request({
  method: 'put',
  url: `/client/update/${id}`,
  data: client
});

/**
 * 删除客户信息
 * @param {number} id 
 */
const clientDelReq = (id) => request({
  method: 'delete',
  url: `/client/delete/${id}`,
});

export {
  clientListReq,
  clientCheckReq,
  clientAppendReq,
  clientUpdateReq,
  clientDelReq
}
